package com.itheima.morning.demo01;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

public class Demo02 {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(10);
        ThreadPoolExecutor pool = (ThreadPoolExecutor) executorService;
        System.out.println(pool.getPoolSize());
        for (int i = 0; i < 11; i++) {
            executorService.submit(()->{
                System.out.println(Thread.currentThread().getName() + "在执行了！");
            });
        }

//        executorService.submit(()->{
//            System.out.println(Thread.currentThread().getName() + "在执行了！");
//        });
        System.out.println(pool.getPoolSize());
        executorService.shutdown();
    }
}
